export default {
	set: function(e, n, o) {
		var r = ''
		if (null != o) {
			var i = new Date(t.now() + 24 * o * 3600 * 1e3)
			r = i.toUTCString()
		}
		var c = [e + '=' + encodeURIComponent(n), 'expires=' + r, 'path=/']
		return (document.cookie = c.join('; ')), this
	},
	get: function(e) {
		var n = document.cookie.split('; '),
			o = ''
		return (
			(e += '='),
			t.each(n, function(n) {
				return t.startsWith(n, e) ? ((o = n.replace(e, '')), !1) : void 0
			}),
			o
		)
	},
	remove: function(t) {
		return this.set(t, '', -1), this
	},
	setItem: function(key, value) {
		if (window.localStorage) {
			localStorage.setItem(key, value)
		} else {
			this.set(key, value, 3650)
		}
	},
	getItem: function(key) {
		return window.localStorage ? localStorage.getItem(key) : this.get(key)
	},
	removeItem: function(key) {
		if (window.localStorage) {
			localStorage.removeItem(key)
		} else {
			this.remove(key)
		}
	}
}
